#!/bin/ash -efu
#
# mki-cache-run-scripts
#
# This file is part of mkimage
# Copyright (C) 2007-2009  Alexey Gladkov <gladkov.alexey@gmail.com>
#
# This file is covered by the GNU General Public License,
# which should be included with mkimage as the file COPYING.
#

case "$cache_type" in
	*-image-*)	scriptdir="${MKI_IMAGE_SCRIPTDIR:?Script directory required}" ;;
	*)		scriptdir="${MKI_SCRIPTDIR:?Script directory required}" ;;
esac

payload() {
	stat --printf='%A\t%s\t%Y\n' "$makefile"

	[ -d "$scriptdir" ] ||
		return 0

	cd "$scriptdir" ||
		return 1

	find -type f -printf '%p %M %s %T@\n' |
	while read script stamp; do
		[ -x "$script" ] ||
			continue

		case "$script" in
			*~|*.bak|*.rpmnew|*.rpmsave) continue ;;
		esac

		printf '%s\n' "$stamp"
	done
}
